/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ik.Reposteria.SMP.Encapsulados;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Malkavian
 */
@Entity
@Table(name = "telefonosagenda", catalog = "smp", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Telefonosagenda.findAll", query = "SELECT t FROM Telefonosagenda t"),
    @NamedQuery(name = "Telefonosagenda.findByAgendaid", query = "SELECT t FROM Telefonosagenda t WHERE t.telefonosagendaPK.agendaid = :agendaid"),
    @NamedQuery(name = "Telefonosagenda.findById", query = "SELECT t FROM Telefonosagenda t WHERE t.telefonosagendaPK.id = :id"),
    @NamedQuery(name = "Telefonosagenda.findByTelefono", query = "SELECT t FROM Telefonosagenda t WHERE t.telefono = :telefono"),
    @NamedQuery(name = "Telefonosagenda.findByExtencion", query = "SELECT t FROM Telefonosagenda t WHERE t.extencion = :extencion"),
    @NamedQuery(name = "Telefonosagenda.findByDescripcion", query = "SELECT t FROM Telefonosagenda t WHERE t.descripcion = :descripcion")})
public class Telefonosagenda implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TelefonosagendaPK telefonosagendaPK;
    @Basic(optional = false)
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "extencion")
    private String extencion;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "TiposTelefonos_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Tipostelefonos tiposTelefonosid;
    @JoinColumn(name = "Agenda_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Agenda agenda;

    public Telefonosagenda() {
    }

    public Telefonosagenda(TelefonosagendaPK telefonosagendaPK) {
        this.telefonosagendaPK = telefonosagendaPK;
    }

    public Telefonosagenda(TelefonosagendaPK telefonosagendaPK, String telefono, String descripcion) {
        this.telefonosagendaPK = telefonosagendaPK;
        this.telefono = telefono;
        this.descripcion = descripcion;
    }

    public Telefonosagenda(int agendaid, String id) {
        this.telefonosagendaPK = new TelefonosagendaPK(agendaid, id);
    }

    public TelefonosagendaPK getTelefonosagendaPK() {
        return telefonosagendaPK;
    }

    public void setTelefonosagendaPK(TelefonosagendaPK telefonosagendaPK) {
        this.telefonosagendaPK = telefonosagendaPK;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getExtencion() {
        return extencion;
    }

    public void setExtencion(String extencion) {
        this.extencion = extencion;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Tipostelefonos getTiposTelefonosid() {
        return tiposTelefonosid;
    }

    public void setTiposTelefonosid(Tipostelefonos tiposTelefonosid) {
        this.tiposTelefonosid = tiposTelefonosid;
    }

    public Agenda getAgenda() {
        return agenda;
    }

    public void setAgenda(Agenda agenda) {
        this.agenda = agenda;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (telefonosagendaPK != null ? telefonosagendaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Telefonosagenda)) {
            return false;
        }
        Telefonosagenda other = (Telefonosagenda) object;
        if ((this.telefonosagendaPK == null && other.telefonosagendaPK != null) || (this.telefonosagendaPK != null && !this.telefonosagendaPK.equals(other.telefonosagendaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.ik.Reposteria.SMP.Encapsulados.Telefonosagenda[ telefonosagendaPK=" + telefonosagendaPK + " ]";
    }
    
}
